package modlgen

import (
	"bufio"
	"fmt"
	"os"
)

type writer struct {
	*bufio.Writer
}

func newWriter(file *os.File) *writer {
	mdoWriter := new(writer)
	mdoWriter.Writer = bufio.NewWriter(file)
	return mdoWriter
}

func (w *writer) Printf(format string, a ...interface{}) {
	if _, err := w.Writer.WriteString(fmt.Sprintf(format, a...)); err != nil {
		panic(fmt.Sprintf("Couldn't write string: "+format, a...))
	}
}
